<template>
    <div>
        <div class="stu_info_wrap">
            <div class="stu_info">
                <h1 class="stu_info_title">入学成绩录入</h1>
                <el-form ref="form" :model="form" label-width="80px">
                    <el-row>
                        <el-col :span="10" :offset="6">
                            <el-form-item label="学号" prop="stu_id">
                                <el-input v-model.trim="form.stu_id"></el-input>
                            </el-form-item>
                            <el-form-item label="姓名" prop="stu_name">
                                <el-input v-model.trim="form.stu_name"></el-input>
                            </el-form-item>
                            <el-form-item label="语文" prop="chinese">
                                <el-input v-model.trim="form.chinese"></el-input>
                            </el-form-item>
                            <el-form-item label="数学" prop="math">
                                <el-input v-model.trim="form.math"></el-input>
                            </el-form-item>
                            <el-form-item label="英语" prop="english">
                                <el-input v-model.trim="form.english"></el-input>
                            </el-form-item>
                            <el-form-item label="理综" prop="lizong">
                                <el-input v-model.trim="form.lizong"></el-input>
                            </el-form-item>
                            <el-form-item label="文综" prop="wenzong">
                                <el-input v-model.trim="form.wenzong"></el-input>
                            </el-form-item>

                            <el-form-item>
                                <el-button type="primary" :plain="true" @click="onSubmit">提交</el-button>
                                <el-button type="primary" @click="goReset">重置</el-button>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
import { req_entry_exam } from "@/api/stuInfo.js";
export default {
    data() {
        return {
            form: {
                stu_id: "",
                stu_name: "",
                chinese: "",
                math: "",
                english: "",
                lizong: "",
                wenzong: "",
            },
        };
    },
    methods: {
        async onSubmit() {
            console.log("这是提交");
            let result = await req_entry_exam(this.form);
            console.log(result);

            this.$message({
                message: "数据提交成功！！",
                type: "success",
                offset: 130,
            });
            //提交完毕自动清空
            this.$refs.form.resetFields();
        },
        goReset() {
            console.log("这是重置");
            this.$refs.form.resetFields();
        },
    },
};
</script>

<style lang="scss" scoped>
div {
    .stu_info_wrap {
        display: flex;
        justify-content: center;
        align-items: center;

        .stu_info {
            width: 1000px;

            .stu_info_title {
                text-align: center;
                margin-bottom: 20px;
            }
        }
    }
}
</style>